home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / utils / bin2asm / vidstuff.c < prev   
Encoding:
C/C++ Source or Header  |  1994-02-03  |  1.6 KB  |  64 lines

  1. //░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  2. //─────────────────────────────────────────────────────────────────────────
  3. #include <dos.h>
  4. #include <conio.h>
  5.  
  6. // globals for this library
  7.  
  8. char origvideomode;
  9.  
  10. //
  11. // waitvrt - waits for the video retrace to occur, so the screen is
  12. // updated during the retrace (eliminates flicker) Retrace occurs at
  13. // 70Hz.
  14. //
  15. void waitvrt(void)
  16.         {
  17.         asm mov dx,03DAh
  18. ct1:    asm in al,dx
  19.         asm test al,08h
  20.         asm je ct1
  21. ct2:    asm in al,dx
  22.         asm test al,08h
  23.         asm jne ct2
  24.         }
  25. //
  26. // grmode(): puts the VGA card into 320x200x256 mode. (mode 13h)
  27. //
  28. void grmode(void)
  29.         {
  30.         // save original video mode for exit
  31.         asm mov ah,0Fh
  32.         asm int 10h
  33.         origvideomode = _AL;
  34.  
  35.         asm mov ax,0013h                ;// int 10h - set gr mode
  36.         asm int 10h                     ;// mode 13h, 320x200x256
  37.         }
  38.  
  39. //
  40. // tmode(): puts the VGA card into 80x25 text mode. (mode 03h)
  41. //
  42. void tmode(void)
  43.         {
  44.         asm xor ax,ax        ;//int 10h - set gr mode
  45.         _AL = origvideomode;
  46.         asm int 10h          ;//original video mode
  47.         }                   
  48.  
  49. void plotbmp(int x, int y, int xs, int ys, char *bmp)
  50.         {
  51.         unsigned int p,c,d,e=0;
  52.         p = (y*320)+x;
  53.         for (d=0;d<ys;d++)
  54.             {
  55.             for (c=0;c<xs;c++)
  56.                 {
  57.                 pokeb(0xA000,p+c,bmp[e]);
  58.                 e++;
  59.                 }
  60.             p+=320;
  61.             }
  62.         }
  63.  
  64.